package ltd.hyangyang.rpc.core.context;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.type.filter.AnnotationTypeFilter;

import java.lang.annotation.Annotation;

//自定义扫描器
public class CustomScanner extends ClassPathBeanDefinitionScanner {


    public CustomScanner(BeanDefinitionRegistry registry, Class<? extends Annotation> scannType) {
        //执行父类的Regis
        super(registry,false);
        //将包含注解scannType的类型添加到允许通过的类中
        addIncludeFilter(new AnnotationTypeFilter(scannType));

    }

    @Override
    public int scan(String... basePackages) {
        return super.scan(basePackages);
    }
}
